package com.yang.mall.controller.admin;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yang.mall.dto.LiveOrderMasterDTO;
import com.yang.mall.dto.QueryOrderDTO;
import com.yang.mall.entity.LiveOrder;
import com.yang.mall.entity.OLResponse;
import com.yang.mall.service.ILiveOrderService;
import com.yang.mall.vo.LiveOrderVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 订单表 前端控制器
 * </p>
 *
 * @author kadorlin
 * @since 2022-10-21
 */
@Api(tags = "【PC】订单模块")
@RestController
@RequestMapping("/admin/order")
public class LiveOrderAdminController {

    @Autowired
    public ILiveOrderService liveOrderService;

    @ApiOperation("订单明细")
    @GetMapping("detail/{orderId}")
    public OLResponse<LiveOrderVO> detail(@PathVariable Long orderId){
        return new OLResponse().success(liveOrderService.detail(orderId));
    }

    @ApiOperation("订单列表")
    @GetMapping("list")
    public OLResponse<IPage<LiveOrderVO>> orderList(QueryOrderDTO queryOrderDTO){
        return new OLResponse().success(liveOrderService.orderList(queryOrderDTO));
    }

    @ApiOperation("修改订单信息")
    @PostMapping("update")
    public OLResponse update(@RequestBody LiveOrder liveOrder){
        return new OLResponse().success(liveOrderService.updateById(liveOrder));
    }

}
